Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsprim

Package Overview
Dependencies
Maintainers
14
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsprim

utilities for primitive JavaScript types

  • 1.4.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
14
Created

What is jsprim?

The jsprim package provides utilities for working with primitive JavaScript types. It includes functions for deep copying, testing object types, parsing JSON safely, and more. It's designed to offer a collection of utilities that are commonly needed but not provided by the JavaScript standard library.

What are jsprim's main functionalities?

Deep copying objects

This feature allows you to create a deep copy of an object, ensuring that nested objects are also copied rather than just copying the reference.

var jsprim = require('jsprim');
var obj = { a: 1, b: { c: 2 } };
var copy = jsprim.deepCopy(obj);

Checking if a value is an object

This utility helps in determining whether a given value is an object, which can be particularly useful for validation and type checking.

var jsprim = require('jsprim');
var result = jsprim.isObject({}); // true
result = jsprim.isObject(123); // false

Parsing JSON safely

Safely parse a JSON string, catching any errors that occur during parsing and returning `null` instead of throwing an exception.

var jsprim = require('jsprim');
var str = '{ "key": "value" }';
var obj = jsprim.parseJSON(str);

Other packages similar to jsprim

FAQs

Package last updated on 29 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc